var AvatarUrl="default.png";
var SetInfo=document.getElementsByClassName("form-control");
var Info=document.getElementsByClassName("Info");
function ChangeAvatar(){
    if (window.FileReader){
        var reader = new FileReader();
        var file=document.getElementById("HiddenSubmit").files[0];
        reader.readAsDataURL(file);
        reader.addEventListener("load", function () {
            document.getElementById("ShowAvatar").style.backgroundImage="url('"+reader.result+"')";
            AvatarUrl=reader.result;
        }, false);
    }else{
        alert("该浏览器不支持")
    }

}
function Listen() {
    document.getElementById("Push").onclick=function (){
        document.getElementById("HiddenSubmit").click();
    }
    document.getElementById("Save").onclick=function (){
        document.getElementById("avatar").src=AvatarUrl;
        $("#modal").modal("toggle");
    }
}
onload=function (){
    Listen();
}
$(function (){
    SetInfo[0].value=document.getElementById("username").innerText;
    SetInfo[1].value=document.getElementById("introduce").innerText;
    SetInfo[2].value=Info[0].innerText;
    SetInfo[3].value=Info[1].innerText;
    SetInfo[4].value=Info[2].innerText;
    $("#SaveInfo").click(function (){
        document.getElementById("username").innerText=SetInfo[0].value;
        document.getElementById("introduce").innerText=SetInfo[1].value;
        Info[0].innerText=SetInfo[2].value;
        Info[1].innerText=SetInfo[3].value;
        Info[2].innerText=SetInfo[4].value;
    })
})
